<template>
  <div>
    count: {{ count }}<br/>
    getMaxCount: {{ getMaxCount }}<br/>
    getMinCount: {{ getMinCount }}<br/>
    <button @click="actionAdd">count++</button>
    <button @click="jianshao">coint--</button>
  </div>
</template>
<script>
import { mapState, mapGetters, mapActions } from 'vuex'
import { getUserInfo } from '@/api/common'
export default {
  computed: {
    ...mapState('home',['count']),
    // ...mapState({count: (state) => state.home.count}),
    ...mapGetters('table', ['getMaxCount', 'getMinCount'])
  },
  setup() {
    getUserInfo().then(data => {
      console.log('success')
    })
  },
  methods: {
    // 第一个参数为命名空间路径
    ...mapActions('home' ,['actionAdd']),
    add() {
      this.$store.commit('add')
      setTimeout(()=>{},0)
    },
    jianshao() {
      this.$store.commit('home/jianshao')
    }
  }
}
</script>